home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_150 / execlib / readme < prev    next >
Text File  |  1992-05-06  |  4KB  |  128 lines

  1.  
  2. /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
  3.  *                                                                    *
  4.  *        HOW TO BUILD YOUR OWN DISK-RESIDENT SHARED LIBRARY          *
  5.  *                     - WORKING  EXAMPLE -                           *
  6.  *                                                                    *
  7.  *        by Jean-Michel FORGEAS                                      *
  8.  *        February 1988                                               *
  9.  *                                                                    *
  10.  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
  11.  
  12.  
  13.     Here is a WORKING example for LATTICE(TM) C compiler of how to CREATE
  14. and to use your own disk-resident libraries  (such as translator.library,
  15. icon.library, diskfont.library etc.. supplied by Commodore
  16. in LIBS: directory on the Workbench disk).
  17.  
  18.  
  19.                         ----------------
  20.  
  21. These files were compiled with Lattice C 4.0 and assembled with
  22.             MCC Macro Assembler.
  23.  
  24.                         ----------------
  25.  
  26.  
  27.  
  28.   HOW TO BUILD A LIBRARY OF C FUNCTIONS SHARED BY SEVERAL PROGRAMS AND
  29.                  MANAGED BY AMIGADOS AND EXEC ?
  30.  
  31.  
  32.   1) take the following files in RKM vol2, Appendix K:
  33.  
  34.         - asmsupp.i   (Commodore support)  ->  execlib/i_asmsupp.i
  35.         - mylib.i     (skeleton declar. )  ->  execlib/i_flamlib.i
  36.         - mylib.asm   (skeleton library )  ->  execlib/libskel.asm
  37.  
  38.  
  39.   2) declare your new functions in:
  40.  
  41.         - i_flamlib.i
  42.         - libskel.asm
  43.         - libfuncs.c  (your C functions must be written in reentrant manner)
  44.  
  45.  
  46.   3) under the CLI do:
  47.  
  48.         assign LIB: <directory where amiga.lib and AStartup.obj are>
  49.         assign I: <directory of C includes>
  50.         cd execlib
  51.  
  52.         assem libskel.asm -i <dir of .i> -o libskel.obj
  53.                    (--> libskel.obj  716 bytes on disk)
  54.  
  55.         lc1 -iI: -b0 -ccs libfuncs
  56.         lc2 -r -v -s libfuncs
  57.                     (--> libfuncs.o   144 bytes on disk)
  58.  
  59.         execute ex_makelib
  60.                      (--> flam.library 516 bytes on disk)
  61.  
  62.    and that's it. The library should be now in LIBS: directory.
  63.  
  64.  
  65.                            -------------------
  66.  
  67.  
  68.    HOW TO USE THIS LIBRARY WITH YOUR C PROGRAMS ?
  69.  
  70.    1) create a test program that opens, uses and closes the library.
  71.  
  72.         - test.c
  73.  
  74.         NOTE: if you want the library to stay in memory after
  75.               your program exit(), just suppress the call to RemLibrary().
  76.  
  77.    2) create a .lib such as amiga.lib to link your programs with:
  78.  
  79.         - flam.lib.asm
  80.  
  81.  
  82.    3) under the CLI:
  83.  
  84.         lc1 -iI: -b0 -ccs test
  85.         lc2 -r -v -s test
  86.                      (--> test.o   632 bytes on disk)
  87.  
  88.         assem flam.lib.asm -i <dir of .i>  -o flam.lib
  89.                      (--> flam.lib 136 bytes on disk)
  90.  
  91.         blink LIB:AStartup.obj test.o TO test LIB flam.lib LIB:amiga.lib
  92.                      (--> test    2220 bytes on disk)
  93.  
  94.  
  95.                            -------------------
  96.  
  97.  
  98.    NOTE:
  99.         In this example, DOSBase and SysBase are not declared in libskel.asm,
  100.         so if you want to call DOS or Exec functions - add
  101.         the definitions _DOSBase and _SysBase in libskel.asm :
  102.  
  103.             _DOSBase  DS.L 1
  104.             _SysBase  DS.L 1
  105.  
  106.         Don't forget to declare them in XDEF and to initialize them -
  107.         look on initRoutine in libskel.asm.
  108.  
  109.  
  110.         Enjoy !
  111.  
  112.  
  113.                            -------------------
  114.                             ___       _
  115.                            /__  /    /_|   /|/|
  116.                           /    /__  /  |  /   |
  117.  
  118.  
  119.  
  120. CONTACT:
  121. -------
  122.             J-M.Forgeas,
  123.             21 rue Voltaire,
  124.             92300 Levallois-Perret,
  125.             FRANCE
  126.  
  127.  
  128.